package com.qf.com.qf.details.controller;

import com.qf.com.qf.details.service.GrassCommentService;
import com.qf.com.qf.details.vo.GrassDetailsVO;
import com.qf.common.core.entity.GrassComment;
import com.qf.common.core.utils.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author zdl
 * @date 2025/3/28
 */
@RestController
@RequestMapping("/article/grassComment")
public class GrassCommentController {

    @Resource
    private GrassCommentService grassCommentService;

    @GetMapping("/detail/{grassId}")
    public R<?> detail(@PathVariable("grassId") Integer grassId){
        GrassDetailsVO details = grassCommentService.details(grassId);
        return R.ok(details);
    }

    @PostMapping("/comment")
    public R<?> addComment(@RequestBody GrassComment grassComment){
      Integer commentId =  grassCommentService.addComment(grassComment);
        return R.ok(commentId);
    }
}
